Actually use lat AND lon (blush) when computingn distance in track filter.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 2 Jun 2011 00:04:58 +0000 (00:04 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 2 Jun 2011 00:04:58 +0000 (00:04 +0000)
Use sensible thresholds.

gpsbabel/trackfilter.c

index 1e47ec3bf88240b30c5e3c188c7138b35d4bf1b3..4344b83fd2f5a6ae10093f6a5b649d137b897056 100644 (file)
@@ -1087,9 +1087,16 @@ trackfilter_points_are_same(const waypoint *wpta, const waypoint *wptb)
 {
   // We use a simpler (non great circle) test for lat/lon here as this
   // is used for keeping the 'bookends' of non-moving points.
+  //
+  // Latitude spacing is about 27 feet per .00001 degree.
+  // Longitude spacing varies, but the reality is that anything closer
+  // than 27 feet does little but clutter the output.
+  // As this is about the limit of consumer grade GPS, it seems a
+  // reasonable tradeoff.
+
   return
-      abs(wpta->latitude - wptb->latitude) < .0000001 &&
-      abs(wpta->latitude - wptb->latitude) < .0000001 &&
+      fabs(wpta->latitude - wptb->latitude) < .00001 &&
+      fabs(wpta->longitude - wptb->longitude) < .00001 &&
       abs(wpta->altitude - wptb->altitude) < 20 &&
       (WAYPT_HAS(wpta,course) == WAYPT_HAS(wptb,course)) &&
       (wpta->course == wptb->course) &&